'revoke C1 in the already opened C1 website'

Set tempwins=createobject("shell.application") 
Set winsWindows = tempwins.Windows
dim IE,URL
URL="https://xxx.jsp"
For Each WebBrowser In winsWindows
	If WebBrowser.visible =true then
		If Instr(WebBrowser.LocationURL,URL) =1 Then
			Set ie=WebBrowser
			exit for
		end if
	end if
next
Set tempwins=nothing : Set winsWindows=nothing

ExecuteGlobal CreateObject("Scripting.FileSystemObject").OpenTextFile("C1 Invoked Function.vbs",1).ReadAll'调用函数库
winstr = "https://xxx/uiPage"
WshShell.run "C1Inputs.txt",1,true
msgbox "Please save C1 ID in the opened C1Inputs.txt file before click OK"
LoadFile UserIDList 
'----------------------------------------------------------staring loop the  user list'

for each user in UserIDList
	validUser(user)
	if isErrorIDFound = "false"  then
		Set TabPageContent = ie.document.frames(0).document.getelementbyid("tabPage").contentWindow
		while TabPageContent Is Nothing
			WScript.Sleep 200
			Set TabPageContent = ie.document.frames(0).document.getelementbyid("tabPage").contentWindow
		wend
		Set userCharGridContent = TabPageContent.document.getelementbyid("USER_CHAR_GRID").contentWindow
		while userCharGridContent Is Nothing
			WScript.Sleep 200
			Set userCharGridContent = TabPageContent.document.getelementbyid("USER_CHAR_GRID").contentWindow
		wend
		userCharGridContent.document.getelementbyid("IM_USER_CHAR:0$ADD").click : WScript.Sleep 2000
		for loopnum = 0 to 1
			charTypeID ="USER_CHAR:" & loopnum & "$CHAR_TYPE_CD"
			SeqID ="USER_CHAR:" & loopnum & "$SEQ_NUM"
			charValueID ="USER_CHAR:" & loopnum & "$ADHOC_CHAR_VAL"

			Set charType = userCharGridContent.document.getelementbyid(charTypeID)
			while charType Is Nothing
				WScript.Sleep 200 : Set charType= userCharGridContent.document.getelementbyid(charTypeID)
			wend
			Set Seq = userCharGridContent.document.getelementbyid(SeqID)
			Set charValue = userCharGridContent.document.getelementbyid(charValueID)
			if loopnum = 0 then
				charType.focus : charType.value="MSATSU" : charType.FireEvent("onchange")
			else
				charType.focus : charType.value="MSATSP" : charType.FireEvent("onchange")
			end if
			WScript.Sleep 1500 : Seq.focus : Seq.value="10" & (loopnum + 1) : Seq.FireEvent("onblur")
			charValue.focus : charValue.value="changeme" : charValue.FireEvent("onblur") : WScript.Sleep 1500
		next
		ie.document.frames(0).document.getelementbyid("IM_SAVE").click
		WScript.Sleep 5000
	end if
next
msgbox "Script finished successfully!"
